package com.GDOU.bean.activity.dao;

import com.GDOU.bean.activity.Activity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ActivityDao {

//    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    @Insert("insert into tbl_activity (type,name,description) values(#{type},#{name},#{description})")
    public int save(Activity activity);

    @Update("update tbl_activity set type = #{type}, name = #{name}, description = #{description} where id = #{id}")
    public int update(Activity activity);

    @Delete("delete from tbl_activity where id = #{id}")
    public int delete(Integer id);

    @Select("select * from tbl_activity where id = #{id}")
    public Activity getById(Integer id);

    @Select("select * from tbl_activity")
    public List<Activity> getAll();
}
